const ChannelType = {
  DETAIL: 0, //商详页
  ALIVE: 1, //直播带货
  AD: 2, //广告渠道
  COMMUNITY: 3, //圈子
  DOU_YIN: 4, //抖音
  XIAOE_SHOP: 5, //小鹅通小店
};

export function resolveChannelInfo(
  aliveId,
  adType,
  communityIdWindow,
  communityApplyId,
  channelId
) {
  let channelType = ChannelType.DETAIL;
  let channelBusId;

  if (aliveId) {
    channelType = ChannelType.ALIVE;
    channelBusId = aliveId;
  } else if (adType) {
    channelType = ChannelType.AD;
  } else if (communityIdWindow && communityApplyId) {
    channelType = ChannelType.COMMUNITY;
    channelBusId = communityIdWindow;
  } else if (channelId) {
    channelBusId = channelId;
  }

  return {
    channelType,
    channelBusId,
  };
}
